import request from '@/utils/request'

/**
 *获取组织架构的数据
 * @param {Object}  无需参数，get请求
 * @returns 请求的结果，promise对象
 */
export const getSimpleEmpList = () => request.get('/sys/user/simple')

// 获取员工列表
export const getEmpList = (params) => request.get('/sys/user', { params })

// 根据id删除员工
export const delEmployee = id => request.delete(`/sys/user/${id}`)

// 新增员工
export const addEmployee = data => request.post('/sys/user', data)

// 批量导入员工importExcel
export const importExcel = data => request.post('/sys/user/import', data)

// 下载导出模板
export const getTemplate = () => request.get('/sys/user/import/template', { responseType: 'blob' })
// export const getTemplate = () => request.get('/sys/user/import/template', { responseType: 'blob' })

// 导出员工
export const exportExcel = () => request.get('/sys/user/export', { responseType: 'blob' })

// 保存员工基本信息
export const updateEmployeeInfo = id => request.put(`/sys/user/${id}`)

// 更新员工基本信息
export const updateEmployee = data => request.put(`/sys/user/${data.id}`, data)

// 给员工分配角色
export const assignRoles = data => request.put(`/sys/user/assignRoles`, data)

// 获取员工基本信息
export const getEmployeeDetail = id => request.get(`/sys/user/${id}`)

